package com.itheima.reggie.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Lff
 * @date 2022/2/26
 */
@Configuration
public class MybatisConfig {
    /**
     * 配置Mybatis分页拦截器
     * @return
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor mybatis = new MybatisPlusInterceptor();
        //将分页插件天啊及到MP的拦截器列表中
        mybatis.addInnerInterceptor(new PaginationInnerInterceptor());
        return mybatis;
    }
}
